import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class AdminFrame extends JFrame {
    private JTable carTable;
    private JButton addCarButton;
    private JButton deleteCarButton;
    private JButton viewOrdersButton;
    private JButton viewRevenueButton;

    public AdminFrame() {
        setTitle("管理员界面");
        setSize(600, 400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());

        carTable = new JTable();
        JScrollPane scrollPane = new JScrollPane(carTable);
        panel.add(scrollPane, BorderLayout.CENTER);

        JPanel buttonPanel = new JPanel();
        addCarButton = new JButton("添加车辆");
        deleteCarButton = new JButton("删除车辆");
        viewOrdersButton = new JButton("查看订单");
        viewRevenueButton = new JButton("查看营业额");

        buttonPanel.add(addCarButton);
        buttonPanel.add(deleteCarButton);
        buttonPanel.add(viewOrdersButton);
        buttonPanel.add(viewRevenueButton);

        panel.add(buttonPanel, BorderLayout.SOUTH);

        addCarButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 添加车辆逻辑
            }
        });

        deleteCarButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 删除车辆逻辑
            }
        });

        viewOrdersButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 查看订单逻辑
            }
        });

        viewRevenueButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 查看营业额逻辑
            }
        });

        add(panel);
    }
}
